const dbConfig = require("../config/db.config.js");

const Sequelize = require("sequelize");
const sequelize = new Sequelize(dbConfig.database, dbConfig.user, dbConfig.password, {
  host: dbConfig.host,
  dialect: dbConfig.dialect,
  operatorsAliases: false,

  pool: {
    max: dbConfig.pool.max,
    min: dbConfig.pool.min,
    acquire: dbConfig.pool.acquire,
    idle: dbConfig.pool.idle
  }
});

const db = {};

db.Sequelize = Sequelize;
db.sequelize = sequelize;



db.admin_group = require('./table_model/admin_group.js')(sequelize, Sequelize);
db.admin_menu = require('./table_model/admin_menu')(sequelize, Sequelize);
db.admin_role = require('./table_model/admin_role')(sequelize, Sequelize);
db.admin_role_access = require('./table_model/admin_role_access')(sequelize, Sequelize);
db.admin_user = require('./table_model/admin_user')(sequelize, Sequelize);
db.batch_info = require('./table_model/batch_info')(sequelize, Sequelize);
db.customers_account = require('./table_model/customers_account')(sequelize, Sequelize);
db.depart_info = require('./table_model/depart_info')(sequelize, Sequelize);
db.drugs_baseinfo = require('./table_model/drugs_baseinfo')(sequelize, Sequelize);
db.drugs_use_log = require('./table_model/drugs_use_log')(sequelize, Sequelize);
db.enterprise_info = require('./table_model/enterprise_info')(sequelize, Sequelize);
db.farm_baseinfo = require('./table_model/farm_baseinfo')(sequelize, Sequelize);
db.farm_unit_info = require('./table_model/farm_unit_info')(sequelize, Sequelize);
db.feeds_buy = require('./table_model/feeds_buy')(sequelize, Sequelize);
db.feeds_common = require('./table_model/feeds_common')(sequelize, Sequelize);
db.order_check = require('./table_model/order_check')(sequelize, Sequelize);
db.order_express = require('./table_model/order_express')(sequelize, Sequelize);
db.order_info = require('./table_model/order_info')(sequelize, Sequelize);
db.sale_employee = require('./table_model/sale_employee')(sequelize, Sequelize);
db.seedling_buy = require('./table_model/seedling_buy')(sequelize, Sequelize);
db.seedling_common = require('./table_model/seedling_common')(sequelize, Sequelize);
db.seedling_self = require('./table_model/seedling_self')(sequelize, Sequelize);
db.summary_employee = require('./table_model/summary_employee')(sequelize, Sequelize);
db.trans_employee = require('./table_model/trans_employee')(sequelize, Sequelize);

module.exports = db;